//
// Created by kongkong on 16/9/25.
// Copyright (c) 2016 Kongkong. All rights reserved.
//

#import "KKRequest.h"
#import "KKRequestEngine.h"


@implementation KKRequest

+ (KKRequest *)api:(NSString *)api action:(NSString *)action {

    NSParameterAssert(api);
    NSParameterAssert(action);

    KKRequest *request = [KKRequest new];
    request.api = api;
    request.action = action;
    return request;
}

- (KKRequest *)parameter:(NSDictionary *)parameter {
    self.params = [parameter copy];
    return self;
}

- (void)async:(void (^)(id __nullable response, id __nullable result))completion {
    return [[KKRequestEngine instance] asyncWithRequest:self completion:completion];
}

@end
